package com.sn.author.common.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Author xiaom
 * @Date 2020/9/21 19:22
 * @Version 1.0.0
 * @Description <10(登录) 20(关注) 30(点赞) 40(评论)>
 **/
public enum TaskTypeEnum {
    LOGIN(10,"登录"),
    ATTENTION(20,"关注"),
    LIKE(30,"点赞"),
    COMMENT(40,"评论"),
    IM(50,"私信"),
    VIDEOINFO(60,"视频信息"),
    COLLECTION(70,"数据采集")
    ;

    @Getter
    private Integer type;

    @Getter
    private String desc;

    TaskTypeEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static Optional<TaskTypeEnum> match(Integer type) {
        return Arrays.stream(TaskTypeEnum.values())
                .filter(t -> t.getType().equals(type))
                .findFirst();
    }
}
